import React, {Component} from 'react';
import { Spin } from 'antd';
import styles from './index.module.scss';

interface StateInterface {
}

interface PropsInterface {
  height: string,
  enabled: boolean
}

class ComLoading extends Component<PropsInterface, StateInterface> {

  static defaultProps = {
    enabled: true
  }

  render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | string | number | {} | React.ReactNodeArray | React.ReactPortal | boolean | null | undefined {
    if (!this.props.enabled) return null
    return (
      <div className={ `${styles['com-loading']} w-flex-center` } style={{ height: this.props.height }}>
        <Spin size="large"></Spin>
      </div>
    );
  }
}

export default ComLoading;
